﻿using System.Data.Entity;
using Codeplus.Dhruvtaata.Web.Models.Entity;
using System.ComponentModel.DataAnnotations.Schema;

namespace Codeplus.Dhruvtaata.Web.Models {
    public class DatabaseContext : DbContext {
        public DbSet<Address> Addresses { get; set; }
        public DbSet<Person> People { get; set; }
        public DbSet<Exam> Exams { get; set; }
        public DbSet<Question> Questions { get; set; }
        public DbSet<StudentResponse> StudentResponses { get; set; }
        public DbSet<Subject> Subjects { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder) {
            modelBuilder.Entity<Student>().ToTable("Students");
            modelBuilder.Entity<Subject>().Property(p => p.SubjectId).HasDatabaseGeneratedOption(databaseGeneratedOption: DatabaseGeneratedOption.None);
        }
    }
}